<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%><%@ taglib prefix="s" uri="/struts-tags" %><%@ taglib prefix="sap" uri="/sapien-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<s:include value="/WEB-INF/includes/css.jsp" />
	<s:include value="/WEB-INF/includes/javascript.jsp" />
	<title><s:text name="title" /></title>
</head>
<body>
	<div id="container">
		<s:include value="/WEB-INF/includes/header.jsp" />
		<div id="content">
			<div id="content-nav">
				<div class="optmenu rounded">
					<h3 class="rounded-top"><s:text name="actions" /></h3>
					<div class="optmenu-body">
						<ul>
							<li>
								<a href="<s:url action="new-discussion" namespace="/" />">
									<s:text name="new-discussion" />
								</a>
							</li>
						</ul>
					</div>
				</div>
				<s:if test="categories.size() > 0">
					<div class="optmenu rounded">
						<h3 class="rounded-top"><s:text name="categories" /></h3>
						<div class="optmenu-body">
							<ul><s:iterator value="categories">
								<li>
									<a href="<s:url action="category"><s:param name="id" value="id" /></s:url>">
										<s:property value="name"/>
									</a>
								</li>
							</s:iterator></ul>
						</div>
					</div>
				</s:if>
			</div>
			<div id="content-body">
				<h2><s:text name="discussions" /></h2>
				<s:if test="actionMessages.size() > 0">
					<div class="success rounded">
						<s:iterator value="actionMessages"><s:property /><br /></s:iterator>
					</div>
				</s:if>
				<s:if test="actionErrors.size() > 0">
					<div class="error rounded">
						<s:iterator value="actionErrors"><s:property /><br /></s:iterator>
					</div>
				</s:if>
                <s:if test="paginatedResult.results.size() > 0">
                	<div class="frame">
                	<table>
                		<thead>
	                		<tr>
	                			<th><s:text name="subject" /></th>
	                			<th><s:text name="started-by" /></th>
	                			<th><s:text name="messages" /></th>
	                			<th><s:text name="last-message" /></th>
	                		</tr>
                		</thead>
                		<tbody>
	                		<s:iterator value="paginatedResult.results" status="i"><tr <s:if test="#i.odd">class="odd"</s:if>>
	                			<td>
	                				<a href="<s:url action="discussion"><s:param name="id" value="id" /></s:url>">
	                					<s:property value="subject" />
	                				</a>
	                			</td>
	                			<td>
	                				<s:if test="creator != null">
	                					<a href="<s:url action="profile"><s:param name="id" value="creator.id" /></s:url>">
	                						<s:property value="creator.username" />
	                					</a>
	                				</s:if><s:else>
	                					<s:text name="anonymous" />
	                				</s:else>
	                			</td>
	                			<td><s:property value="responseCount" /></td>
	                			<td>
	                				<s:date name="modified" nice="true"/><br />
	                				by
	                				<s:if test="modifier != null">
	                					<a href="<s:url action="profile"><s:param name="id" value="modifier.id" /></s:url>">
	                						<s:property value="modifier.username" />
	                					</a>
	                				</s:if><s:else>
	                					<s:text name="anonymous" />
	                				</s:else>
	                			</td>
	                		</tr></s:iterator>
                		</tbody>
                	</table>
                	</div>
                	<sap:pager cssClass="pager" page="page" nextLabel="Next" prevLabel="Previous" resultsPerPage="paginatedResult.resultsPerPage" total="paginatedResult.totalPages" totalResults="paginatedResult.totalResults" />
                </s:if><s:else>
                	<p class="info"><s:text name="no-discussions" /></p>
                </s:else>
                
			</div>
			<div class="clear">&nbsp;</div>
		</div>
		<s:include value="/WEB-INF/includes/footer.jsp" />
	</div>
</body>
</html>
